package com.example.demo.rest;

import com.example.demo.model.User;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;


@RestController
@RequestMapping(value = "demo")
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping(value = "hello")
    public Map demo(){
        User user = new User();
        user.setAge(11);
        user.setName("谢子豪");
        userService.addUser(user);
        HashMap<Object, Object> map = new HashMap<>();
        map.put("info","ok");
        return map;
    }
}
